#!/usr/bin/env ruby

class String
  def starts_with? aString
    rindex(aString, 0) == 0
  end
  
  def ends_with? aString
    index(aString) == self.length - aString.length
  end
end

str = "Just another string"
puts str.starts_with?("Ju") # should be true
puts str.starts_with?("str") # should be false

puts str.ends_with?("ing") # should be true
puts str.ends_with?("str") # should be false
